#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct{
	char name[50];
	float score1;
	float score2;
	float score3;
	float sum;
}student;

int main()
{
	int n;
	scanf("%d",&n);
	student student[n];
	for(int i=0;i<n;i++)
	{
		scanf("%s %f %f %f",student[i].name,&student[i].score1,&student[i].score2,&student[i].score3);
		student[i].sum=student[i].score1+student[i].score2+student[i].score3;
	}
	for(int i=0;i<n;i++)
	{
		if(student[i].sum>=180)
		{
			printf("%s -- pass exam\n",student[i].name);
		}
	} 
	for(int i=0;i<n;i++)
	{
		if(student[i].sum<180)
		{
			printf("%s -- not pass exam\n",student[i].name);
		}
	}
	for(int i=0;i<n;i++)
	{
		if(student[i].sum==300)
		{
			printf("%s -- 3 x 100.0\n",student[i].name);
		}
	}
	return 0; 
} 
